unit u_menu;

interface

uses
  System.Drawing,
  system.Windows.Forms,
  windows,
  sysutils,
  u_menu_in_game,
  u_font,
  shellAPI,
  u_sound,
  u_animsprite,
  u_player,
  u_gamemenu,
  u_partic,
  u_ia,
  Microsoft.DirectX.DirectInput,
  Microsoft.DirectX.Direct3DX,
  Microsoft.DirectX.Direct3D,
  Microsoft.DirectX;


type                           

  c_menu = class

    private

    const
       resol : Array [0..5] of string = ('800 / 600',  '1024 / 768', '1280 / 800', '1280 / 960', '1680 / 1050', 'Maximisé');
       fog_val : Array [0..4]  of string = ('10', '15', '20', '30', '40');

    var

      //Sprites des menus

      //menu principal 1
      _1multi : c_animsprite;
      _1option : c_animsprite;
      _1quitter : c_animsprite;
      _1site : c_animsprite;

      //Menu client ou serveur 2
      _2client : c_animsprite;
      _2serveur : c_animsprite;

      //Client 3
      _3pseudo : c_animsprite;
      _3pseudotext : c_animsprite;
      _3ip : c_animsprite;
      _3iptext : c_animsprite;
      _3jouer : c_animsprite;

      //Serveur 4
      _4pseudo : c_animsprite;
      _4pseudotext : c_animsprite;
      _4map : c_animsprite;
      _4maptext : c_animsprite;
      _4jouer : c_animsprite;

      //Solo 5
      _5map : c_animsprite;
      _5maptext : c_animsprite;
      _5charger : c_animsprite;
      _5chargertext : c_animsprite;
      _5jouer : c_animsprite;

      //Quitter 6
      _6quitter : c_animsprite;
      _6oui : c_animsprite;
      _6non : c_animsprite;

      //Options 7
      _7resolution :c_animsprite;
      _7resolutiontext : c_animsprite;
      _7resolutiondroit : c_animsprite;
      _7resolutiongauche : c_animsprite;
      _7son : c_animsprite;
      _7sonoui : c_animsprite;
      _7sonnon : c_animsprite;
      _7fog : c_animsprite;
      _7fogtext : c_animsprite;
      _7fogdroit : c_animsprite;
      _7foggauche : c_animsprite;
      _7ok : c_animsprite;
      _7annuler : c_animsprite;
      _7apply : c_animsprite;

      _8titou : c_animsprite;
      _8clad : c_animsprite;
      _8xoy : c_animsprite;
      _8mouton : c_animsprite;
      _8droit : c_animsprite;
      _8gauche : c_animsprite;
      _8jouer : c_animsprite;

      _retour : c_animsprite;

      //Pour savoir si on est encore dans le menu (Si on l'affiche)

      num_menu : integer;
      goto_menu : integer;
      is_in_menu : integer;
      num_player : integer;

      was_played_retour : boolean;


      //les sons du menu

      survol : c_sound;
      clik : c_sound;

      select_map : boolean;
      select_save : boolean;

      case_cocher : Sprite;

      //Le texte à afficher

      client_ipserveur : u_text;
      client_pseudo : u_text;

      serveur_pseudo : u_text;
      serveur_map : u_text;

      solo_map : u_text;
      solo_charge : u_text;

      text_resol : u_text;
      text_fog : u_text;

      num_resol : integer;
      num_fog : integer;

      focus : string;

      //taille de l'écran
      width : integer;
      heigth : integer;

      test : Device;

      was_played:boolean;

      is_actif : boolean;
      procedure hide_text;
      function int_to_char(key_ : integer) : char;


    public
      player_name: string;
      dist_fog : integer;
      _1solo : c_animsprite;
      constructor create(FDevice : Device);
      procedure show_texture(mouse_x, mouse_y : integer);
      procedure render_text;
      procedure on_click(mouse_x, mouse_y : integer);
      function show_menu : boolean;
      procedure on_key(b : integer);
      function is_active : boolean;
      procedure montre_menu;
      procedure onresize(_width, _heigth : integer);

  end;

implementation

uses u_engine;

  procedure c_menu.montre_menu;
    begin
      num_menu := 1;
      _1multi.faire_sortir;
      _1option.faire_sortir;
      _1quitter.faire_sortir;
      _1site.faire_sortir;
      _1solo.faire_sortir;
      _1multi.set_out;
      _1option.set_out;
      _1quitter.set_out;
      _1site.set_out;
      _1solo.set_out;
      is_actif := True;
    end;

  constructor c_menu.create(FDevice: Device);
    begin
      inherited create;

      test := FDevice;


      survol := c_sound.create('Sound\keyb1.wav');
      clik := c_sound.create('Sound\keyb2.wav');

      heigth := 634;
      width := 808;

      _1solo := c_animsprite.create(FDevice, 'asus menu\menu_princ\modesolo.png', 'asus menu\menu_princ\modesolo1.png', heigth div 5 - 15, width div 2 - 137);
      _1multi := c_animsprite.create(FDevice, 'asus menu\menu_princ\modemulti.png', 'asus menu\menu_princ\modemulti1.png', 2 * heigth div 5 - 15, width div 2 - 137);
      _1option := c_animsprite.create(FDevice, 'asus menu\menu_princ\options.png', 'asus menu\menu_princ\options1.png', 3 * heigth div 5 - 15, width div 2 - 137);
      _1quitter := c_animsprite.create(FDevice, 'asus menu\menu_princ\quitter.png', 'asus menu\menu_princ\quitter1.png', 4 * heigth div 5 - 15, width div 2 - 137);
      _1site := c_animsprite.create(FDevice, 'asus menu\menu_princ\site.png', 'asus menu\menu_princ\site1.png', 15, 15);
      _2client := c_animsprite.create(FDevice, 'asus menu\menu_princ\client.png', 'asus menu\menu_princ\client1.png', heigth div 3 - 15, width div 2 - 137);
      _2serveur := c_animsprite.create(FDevice, 'asus menu\menu_princ\serveur.png', 'asus menu\menu_princ\serveur1.png', 2 * heigth div 3 - 15, width div 2 - 137);

      _3pseudo := c_animsprite.create(FDevice, 'asus menu\menu_princ\pseudo.png', 'asus menu\menu_princ\pseudo1.png', heigth div 4 - 35, width div 2 - 137);
      _3pseudotext := c_animsprite.create(FDevice, 'asus menu\menu_princ\barratexte.png', 'asus menu\menu_princ\barratexte1.png', heigth div 4, width div 2 - 107);
      _3ip := c_animsprite.create(FDevice, 'asus menu\menu_princ\ip.png', 'asus menu\menu_princ\ip1.png', 2 * heigth div 4 - 35, width div 2 - 137);
      _3iptext := c_animsprite.create(FDevice, 'asus menu\menu_princ\barratexte.png', 'asus menu\menu_princ\barratexte1.png', 2 * heigth div 4, width div 2 - 107);
      _3jouer := c_animsprite.create(FDevice, 'asus menu\menu_princ\jouer.png', 'asus menu\menu_princ\jouer1.png', 3 * heigth div 4 - 15, width div 2 - 137);

      _4pseudo := c_animsprite.create(FDevice, 'asus menu\menu_princ\pseudo.png', 'asus menu\menu_princ\pseudo1.png', heigth div 4 - 35, width div 2 - 137);
      _4pseudotext := c_animsprite.create(FDevice, 'asus menu\menu_princ\barratexte.png', 'asus menu\menu_princ\barratexte1.png', heigth div 4, width div 2 - 107);
      _4map := c_animsprite.create(FDevice, 'asus menu\menu_princ\choix map.png', 'asus menu\menu_princ\choix map1.png', 2 * heigth div 4 - 35, width div 2 - 137);
      _4maptext := c_animsprite.create(FDevice, 'asus menu\menu_princ\barratexte.png', 'asus menu\menu_princ\barratexte1.png', 2 * heigth div 4, width div 2 - 107);
      _4jouer := c_animsprite.create(FDevice, 'asus menu\menu_princ\jouer.png', 'asus menu\menu_princ\jouer1.png', 3 * heigth div 4 - 15, width div 2 - 137);

      _5map := c_animsprite.create(FDevice, 'asus menu\menu_princ\choix map.png', 'asus menu\menu_princ\choix map1.png', heigth div 4 - 35, width div 2 - 137);
      _5maptext := c_animsprite.create(FDevice, 'asus menu\menu_princ\barratexte.png', 'asus menu\menu_princ\barratexte1.png', heigth div 4, width div 2 - 107);
      _5charger := c_animsprite.create(FDevice, 'asus menu\menu_princ\charger.png', 'asus menu\menu_princ\charger1.png', 2 * heigth div 4 - 35, width div 2 - 137);
      _5chargertext := c_animsprite.create(FDevice, 'asus menu\menu_princ\barratexte.png', 'asus menu\menu_princ\barratexte1.png', 2 * heigth div 4, width div 2 - 107);
      _5jouer := c_animsprite.create(FDevice, 'asus menu\menu_princ\choixjoueur.png', 'asus menu\menu_princ\choixjoueur1.png', 3 * heigth div 4 - 15, width div 2 - 137);

      _6quitter := c_animsprite.create(FDevice, 'asus menu\menu_princ\quitter.png', 'asus menu\menu_princ\quitter1.png', heigth div 3 - 15, width div 2 - 137);
      _6oui := c_animsprite.create(FDevice, 'asus menu\menu_princ\oui.png', 'asus menu\menu_princ\oui1.png', 2 * heigth div 3 - 15, width div 2 - 140);
      _6non := c_animsprite.create(FDevice, 'asus menu\menu_princ\non.png', 'asus menu\menu_princ\non1.png', 2 * heigth div 3 - 15, width div 2 + 5);

      _7resolution := c_animsprite.create(FDevice, 'asus menu\menu_princ\resolution.png', 'asus menu\menu_princ\resolution1.png', heigth div 5 - 35, width div 2 - 137);
      _7resolutiontext := c_animsprite.create(FDevice, 'asus menu\menu_princ\barratexte.png', 'asus menu\menu_princ\barratexte1.png', heigth div 5, width div 2 - 107);
      _7resolutiondroit := c_animsprite.create(FDevice, 'asus menu\menu_princ\next.png', 'asus menu\menu_princ\next1.png', heigth div 5, width div 2 + 110);
      _7resolutiongauche := c_animsprite.create(FDevice, 'asus menu\menu_princ\prec.png', 'asus menu\menu_princ\prec1.png', heigth div 5, width div 2 - 140);

      _7son := c_animsprite.create(FDevice, 'asus menu\menu_princ\son.png', 'asus menu\menu_princ\son1.png', 2 * heigth div 5 - 35, width div 2 - 137);
      _7sonoui := c_animsprite.create(FDevice, 'asus menu\menu_princ\oui.png', 'asus menu\menu_princ\oui1.png', 2 * heigth div 5, width div 2 - 140);
      _7sonnon := c_animsprite.create(FDevice, 'asus menu\menu_princ\non.png', 'asus menu\menu_princ\non1.png', 2 * heigth div 5, width div 2 + 5);

      _7fog := c_animsprite.create(FDevice, 'asus menu\menu_princ\brouillard.png', 'asus menu\menu_princ\brouillard1.png', 3 * heigth div 5 - 35, width div 2 - 137);
      _7fogtext := c_animsprite.create(FDevice, 'asus menu\menu_princ\barratexte.png', 'asus menu\menu_princ\barratexte1.png', 3 * heigth div 5, width div 2 - 107);
      _7fogdroit := c_animsprite.create(FDevice, 'asus menu\menu_princ\next.png', 'asus menu\menu_princ\next1.png', 3 * heigth div 5, width div 2 + 110);
      _7foggauche := c_animsprite.create(FDevice, 'asus menu\menu_princ\prec.png', 'asus menu\menu_princ\prec1.png', 3 * heigth div 5, width div 2 - 140);


      _7ok := c_animsprite.create(FDevice, 'asus menu\menu_princ\ok.png', 'asus menu\menu_princ\ok1.png', 4 * heigth div 5 - 50, width div 2 - 68);
      _7annuler := c_animsprite.create(FDevice, 'asus menu\menu_princ\annuler.png', 'asus menu\menu_princ\annuler1.png', 4 * heigth div 5 - 15, width div 2 - 68);
      _7apply := c_animsprite.create(FDevice, 'asus menu\menu_princ\appliquer.png', 'asus menu\menu_princ\appliquer1.png', 4 * heigth div 5 + 20, width div 2 - 68);

      _8titou := c_animsprite.create(FDevice, 'asus menu\menu_princ\titou.png', 'asus menu\menu_princ\titou.png', 150, width div 2 - 97);
      _8clad := c_animsprite.create(FDevice, 'asus menu\menu_princ\clad.png', 'asus menu\menu_princ\clad.png', 150, width div 2 - 97);
      _8mouton := c_animsprite.create(FDevice, 'asus menu\menu_princ\mouton.png', 'asus menu\menu_princ\mouton.png', 150, width div 2 - 97);
      _8xoy := c_animsprite.create(FDevice, 'asus menu\menu_princ\xoy.png', 'asus menu\menu_princ\xoy.png', 150, width div 2 - 97);

      _8droit := c_animsprite.create(FDevice, 'asus menu\menu_princ\next.png', 'asus menu\menu_princ\next1.png', 277, width div 2 + 107);
      _8gauche := c_animsprite.create(FDevice, 'asus menu\menu_princ\prec.png', 'asus menu\menu_princ\prec1.png', 277, width div 2 - 137);
      _8jouer := c_animsprite.create(FDevice, 'asus menu\menu_princ\jouer.png', 'asus menu\menu_princ\jouer1.png', 420, width div 2 - 137);



      _retour := c_animsprite.create(FDevice, 'asus menu\menu_princ\retour.png', 'asus menu\menu_princ\retour1.png', heigth - 80, width - 200);


      num_player := 1; //1 : titou, 2 : clad, 3 : xoy, 4 : Mouton

      select_map := true;
      select_save := false;
      num_menu := 1;
      goto_menu := 1;
      is_in_menu := 0;
      dist_fog := 10;

      is_actif := true;

      player_name := 'caca';

      client_ipserveur := u_text.create(FDevice, 14, color.Blue,'', 'Comic Sans MS', FontStyle.Regular);
      client_ipserveur.set_visible(False);

      client_pseudo := u_text.create(FDevice, 14, color.Blue,'', 'Comic Sans MS', FontStyle.Regular);
      client_pseudo.set_visible(False);

      serveur_pseudo := u_text.create(FDevice, 14, Color.Blue, '', 'Comic Sans MS', FontStyle.Regular);
      serveur_pseudo.set_visible(False);

      serveur_map := u_text.create(FDevice, 14, Color.Blue, '', 'Comic Sans MS', FontStyle.Regular);
      serveur_map.set_visible(False);

      solo_map := u_text.create(FDevice, 14, Color.Blue, '', 'Comic Sans MS', FontStyle.Regular);
      solo_map.set_visible(False);

      solo_charge := u_text.create(FDevice, 14, Color.Blue, '', 'Comic Sans MS', FontStyle.Regular);
      solo_charge.set_visible(False);

      text_resol := u_text.create(FDevice, 14, Color.Blue, resol[0], 'Comic Sans MS', FontStyle.Regular);
      text_resol.set_visible(False);

      text_fog := u_text.create(FDevice, 14, Color.Blue, fog_val[0], 'Comic Sans MS', FontStyle.Regular);
      text_fog.set_visible(False);

      num_resol := 0;
      num_fog := 0;


      case_cocher := Sprite.Create(FDevice);

      focus := 'none';

      was_played := false;
      was_played_retour := false;

    end;

  procedure c_menu.show_texture(mouse_x: Integer; mouse_y: Integer);
    begin
      mouse_x := mouse_x + 10;
      mouse_y := mouse_y + 10;

      case num_menu of
        1 : begin
          //PRINCIPAL
              if _retour.est_dedans then
                _retour.faire_sortir;

              if not _2serveur.est_dehors then
                begin
                  _2serveur.render;
                  Exit;
                end;

              if not _3jouer.est_dehors then
                begin
                  _3jouer.render;
                  Exit;
                end;

              if not _4jouer.est_dehors then
                begin
                  _4jouer.render;
                  Exit;
                end;

              if not _5jouer.est_dehors then
                begin
                  _5jouer.render;
                  Exit;
                end;

              if not _6non.est_dehors then
                begin
                  _6non.render;
                  Exit;
                end;

              if not _7apply.est_dehors then
                begin
                  _7apply.render;
                  Exit;
                end;

              if is_in_menu <> 1 then
                _1solo.faire_venir;

              is_in_menu := 1;

          if (mouse_x > 15) and (mouse_x < 152)
              and (mouse_y > 15) and (mouse_y < 45) then
              begin
                if not was_played then
                  begin
                    survol.play;
                    was_played := true;
                  end;
                _1site.pause;                
              end
              else
          if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
             and (mouse_y > heigth div 5 - 15) and (mouse_y < heigth div 5 + 15) then
              begin
                if not was_played then
                  begin
                    survol.play;
                    was_played := true;
                  end;
                _1solo.pause
              end
          else
            if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
               and (mouse_y > 2 * heigth div 5 - 15) and (mouse_y < 2 * heigth div 5 + 15) then
                begin
                  if not was_played then
                    begin
                      survol.play;
                      was_played := true;
                    end;
                  _1multi.pause
                end
            else
              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                 and (mouse_y > 3 * heigth div 5 - 15) and (mouse_y < 3 * heigth div 5 + 15) then
                  begin
                    if not was_played then
                      begin
                        survol.play;
                        was_played := true;
                      end;
                    _1option.pause
                  end
              else
                if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                   and (mouse_y > 4 * heigth div 5 - 15) and (mouse_y < 4 * heigth div 5 + 15) then
                    begin
                      if not was_played then
                        begin
                          survol.play;
                          was_played := true;
                        end;
                      _1quitter.pause
                    end
                else
                  begin
                    _1quitter.play;
                    _1multi.play;
                    _1option.play;
                    _1solo.play;
                    _1site.play;
                    was_played := false;
                  end;

        if _1solo.est_dehors and _1multi.est_dedans then
          _1multi.faire_sortir;

        if _1multi.est_dehors and _1option.est_dedans then
          _1option.faire_sortir;

        if _1option.est_dehors and _1quitter.est_dedans then
          begin
            _1quitter.faire_sortir;
            _1site.faire_sortir;
            _1site.set_out;
            num_menu := goto_menu;
          end;

        if _1solo.est_dedans and _1multi.est_dehors then
          _1multi.faire_venir;

        if _1multi.est_dedans and _1option.est_dehors then
          _1option.faire_venir;

        if _1option.est_dedans and _1quitter.est_dehors then
          _1quitter.faire_venir;

        if _1quitter.est_dedans and _1site.est_dehors then
          begin
            _1site.faire_venir;
            _1site.set_in;
          end;

        _1solo.render;
        _1multi.render;
        _1option.render;
        _1quitter.render;
        _1site.render;

        end;
        2 : begin
//            //MULTI!
              if not _1quitter.est_dehors then
                begin
                  _1quitter.render;
                  Exit;
                end;

              if not _3jouer.est_dehors then
                begin
                  _3jouer.render;
                  Exit;
                end;

              if not _4jouer.est_dehors then
                begin
                  _4jouer.render;
                  Exit;
                end;

              if not _5jouer.est_dehors then
                begin
                  _5jouer.render;
                  Exit;
                end;

              if not _6non.est_dehors then
                begin
                  _6non.render;
                  Exit;
                end;

              if not _7apply.est_dehors then
                begin
                  _7apply.render;
                  Exit;
                end;

              if _retour.est_dehors then
                _retour.faire_venir;

              if is_in_menu <> 2 then
                _2client.faire_venir;

              is_in_menu := 2;

              
              if _2client.est_dedans and _2serveur.est_dehors then
                _2serveur.faire_venir;

              if _2client.est_dehors and _2serveur.est_dedans then
                begin
                  _2serveur.faire_sortir;
                  num_menu := goto_menu;
                end;

              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                 and (mouse_y > heigth div 3 - 15) and (mouse_y < heigth div 3 + 15) then
                  begin
                    if not was_played then
                      begin
                        survol.play;
                        was_played := true;
                      end;
                    _2client.pause
                  end
                  else
                    if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                       and (mouse_y > 2 * heigth div 3 - 15) and (mouse_y < 2 * heigth div 3 + 15) then
                        begin
                          if not was_played then
                            begin
                              survol.play;
                              was_played := true;
                            end;
                          _2serveur.pause
                        end
                     else
                        begin
                          _2client.play;
                          _2serveur.play;
                          was_played := false;
                        end;
//
//              if _2client.est_dehors and _2serveur.est_dehors then
//                begin
//                  num_menu := goto_menu;
//                  case num_menu of
//                    1 : _1solo.faire_venir;
//                  end;
//                  Exit;
//                end;

              _2client.render;
              _2serveur.render;

        end;
        3 : begin
//            //CLIENT

              if not _1quitter.est_dehors then
                begin
                  _1quitter.render;
                  Exit;
                end;

              if not _2serveur.est_dehors then
                begin
                  _2serveur.render;
                  Exit;
                end;

              if not _4jouer.est_dehors then
                begin
                  _4jouer.render;
                  Exit;
                end;

              if not _5jouer.est_dehors then
                begin
                  _5jouer.render;
                  Exit;
                end;

              if not _6non.est_dehors then
                begin
                  _6non.render;
                  Exit;
                end;

              if not _7apply.est_dehors then
                begin
                  _7apply.render;
                  Exit;
                end;

              if _retour.est_dehors then
                _retour.faire_venir;

              if is_in_menu <> 3 then
                _3pseudo.faire_venir;

              is_in_menu := 3;

              if _3pseudo.est_dedans and _3pseudo.est_dehors then
                _3pseudo.faire_venir;

              if _3pseudo.est_dedans and _3pseudotext.est_dehors then
                _3pseudotext.faire_venir;

              if _3pseudotext.est_dedans and _3ip.est_dehors then
                begin
                  _3ip.faire_venir;
                  client_pseudo.set_coord(trunc(width div 2 - 100), trunc(heigth div 4 - 5));
                  client_pseudo.set_visible(true);
                end;

              if _3ip.est_dedans and _3iptext.est_dehors then
                _3iptext.faire_venir;

              if _3iptext.est_dedans and _3jouer.est_dehors then
                begin
                  _3jouer.faire_venir;
                  client_ipserveur.set_coord(trunc(width div 2 - 100), trunc(2 * heigth div 4 - 5));
                  client_ipserveur.set_visible(true);
                end;


              if _3pseudo.est_dehors and _3pseudotext.est_dedans then
                begin
                  _3pseudotext.faire_sortir;
                  client_pseudo.set_visible(False);
                end;

              if _3pseudotext.est_dehors and _3ip.est_dedans then
                _3ip.faire_sortir;

              if _3ip.est_dehors and _3iptext.est_dedans then
                begin
                  _3iptext.faire_sortir;
                  client_ipserveur.set_visible(false);
                end;

              if _3iptext.est_dehors and _3jouer.est_dedans then
                begin
                  _3jouer.faire_sortir;
                  num_menu := goto_menu;
                end;

              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                and (mouse_y > heigth div 4 - 35) and (mouse_y < heigth div 4 + 5) then
                  begin
                    if not was_played then
                      begin
                        survol.play;
                        was_played := true;
                      end;
                    _3pseudo.pause
                  end
                else
                 if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                    and (mouse_y > heigth div 4) and (mouse_y < heigth div 4 + 30) then
                      begin
                        if not was_played then
                          begin
                            survol.play;
                            was_played := true;
                          end;
                        _3pseudotext.pause
                      end
                    else
                      if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                        and (mouse_y > 2 * heigth div 4 - 35) and (mouse_y < 2 * heigth div 4 + 5) then
                          begin
                            if not was_played then
                              begin
                                survol.play;
                                was_played := true;
                              end;
                            _3ip.pause
                          end
                        else
                         if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                          and (mouse_y > 2 * heigth div 4) and (mouse_y < 2 * heigth div 4 + 30) then
                            begin
                              if not was_played then
                                begin
                                  survol.play;
                                  was_played := true;
                                end;
                              _3iptext.pause
                            end
                          else
                          if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                            and (mouse_y > 3 * heigth div 4 - 15) and (mouse_y < 3 * heigth div 4 + 15) then
                              begin
                                if not was_played then
                                  begin
                                    survol.play;
                                    was_played := true;
                                  end;
                                _3jouer.pause
                              end
                            else
                              begin
                                _3jouer.play;
                                _3pseudo.play;
                                _3pseudotext.play;
                                _3ip.play;
                                _3iptext.play;
                                was_played := false;
                              end;

              _3pseudo.render;
              _3pseudotext.render;
              _3ip.render;
              _3iptext.render;
              _3jouer.render;
              client_ipserveur.text_render;
              client_pseudo.text_render;

        end;
        4 : begin
//            //SERVEUR
              if not _1quitter.est_dehors then
                begin
                  _1quitter.render;
                  Exit;
                end;

              if not _2serveur.est_dehors then
                begin
                  _2serveur.render;
                  Exit;
                end;

              if not _3jouer.est_dehors then
                begin
                  _3jouer.render;
                  Exit;
                end;

              if not _5jouer.est_dehors then
                begin
                  _5jouer.render;
                  Exit;
                end;

              if not _6non.est_dehors then
                begin
                  _6non.render;
                  Exit;
                end;

              if not _7apply.est_dehors then
                begin
                  _7apply.render;
                  Exit;
                end;
               
              if _retour.est_dehors then
                _retour.faire_venir;

              if is_in_menu <> 4 then
                _4pseudo.faire_venir;

              is_in_menu := 4;

              if _4pseudo.est_dedans and _4pseudotext.est_dehors then
                _4pseudotext.faire_venir;

              if _4pseudotext.est_dedans and _4map.est_dehors then
                begin
                  _4map.faire_venir;
                  serveur_pseudo.set_coord(trunc(width div 2 - 100), trunc(heigth div 4 - 5));
                  serveur_pseudo.set_visible(true);
                end;

              if _4map.est_dedans and _4maptext.est_dehors then
                _4maptext.faire_venir;

              if _4maptext.est_dedans and _4jouer.est_dehors then
                begin
                  _4jouer.faire_venir;
                  serveur_map.set_coord(trunc(width div 2 - 100), trunc(2 * heigth div 4 - 5));
                  serveur_map.set_visible(true);
                end;


              if _4pseudo.est_dehors and _4pseudotext.est_dedans then
                begin
                  _4pseudotext.faire_sortir;
                  serveur_pseudo.set_visible(false);
                end;

              if _4pseudotext.est_dehors and _4map.est_dedans then
                _4map.faire_sortir;

              if _4map.est_dehors and _4maptext.est_dedans then
                begin
                  _4maptext.faire_sortir;
                  serveur_map.set_visible(false);
                end;

              if _4maptext.est_dehors and _4jouer.est_dedans then
                begin
                  num_menu := goto_menu;
                  _4jouer.faire_sortir;
                end;



              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                and (mouse_y > heigth div 4 - 35) and (mouse_y < heigth div 4 + 5) then
                  begin
                    if not was_played then
                      begin
                        survol.play;
                        was_played := true;
                      end;
                    _4pseudo.pause
                  end
                else
                  if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                    and (mouse_y > heigth div 4) and (mouse_y < heigth div 4 + 30) then
                      begin
                        if not was_played then
                          begin
                            survol.play;
                            was_played := true;
                          end;
                        _4pseudotext.pause
                      end
                    else
                      if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                        and (mouse_y > 2 * heigth div 4 - 35) and (mouse_y < 2 * heigth div 4 + 5) then
                          begin
                            if not was_played then
                              begin
                                survol.play;
                                was_played := true;
                              end;
                            _4map.pause
                          end
                        else
                          if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                            and (mouse_y > 2 * heigth div 4) and (mouse_y < 2 * heigth div 4 + 30) then
                              begin
                                if not was_played then
                                  begin
                                    survol.play;
                                    was_played := true;
                                  end;
                                _4maptext.pause
                              end
                            else
                              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                                and (mouse_y > 3 * heigth div 4 - 15) and (mouse_y < 3 * heigth div 4 + 15) then
                                  begin
                                    if not was_played then
                                      begin
                                        survol.play;
                                        was_played := true;
                                      end;
                                    _4jouer.pause
                                  end
                                else
                                  begin
                                    _4pseudo.play;
                                    _4pseudotext.play;
                                    _4map.play;
                                    _4maptext.play;
                                    _4jouer.play;
                                    was_played := false;
                                  end;

              _4pseudo.render;
              _4pseudotext.render;
              _4map.render;
              _4maptext.render;
              _4jouer.render;
              serveur_pseudo.text_render;
              serveur_map.text_render;
        end;
        5 : begin
              //SOLO
              if not _1quitter.est_dehors then
                begin
                  _1quitter.render;
                  Exit;
                end;

              if not _2serveur.est_dehors then
                begin
                  _2serveur.render;
                  Exit;
                end;

              if not _3jouer.est_dehors then
                begin
                  _3jouer.render;
                  Exit;
                end;

              if not _4jouer.est_dehors then
                begin
                  _4jouer.render;
                  Exit;
                end;

              if not _6non.est_dehors then
                begin
                  _6non.render;
                  Exit;
                end;

              if not _7apply.est_dehors then
                begin
                  _7apply.render;
                  Exit;
                end;
                          
              if _retour.est_dehors then
                _retour.faire_venir;

              if is_in_menu <> 5 then
                _5map.faire_venir;

              is_in_menu := 5;

              if _5map.est_dedans and _5maptext.est_dehors then
                _5maptext.faire_venir;

              if _5maptext.est_dedans and _5charger.est_dehors then
                begin
                  _5charger.faire_venir;
                  solo_map.set_coord(trunc(width div 2 - 100), trunc(heigth div 4 - 5));
                  solo_map.set_visible(true);
                end;

              if _5charger.est_dedans and _5chargertext.est_dehors then
                _5chargertext.faire_venir;

              if _5chargertext.est_dedans and _5jouer.est_dehors then
                begin
                  _5jouer.faire_venir;
                  solo_charge.set_coord(trunc(width div 2 - 100), trunc(2 * heigth div 4 - 5));
                  solo_charge.set_visible(true);
                end;


              if _5map.est_dehors and _5maptext.est_dedans then
                begin
                  _5maptext.faire_sortir;
                  solo_map.set_visible(false);
                end;

              if _5maptext.est_dehors and _5charger.est_dedans then
                _5charger.faire_sortir;

              if _5charger.est_dehors and _5chargertext.est_dedans then
                begin
                  _5chargertext.faire_sortir;
                  solo_charge.set_visible(false);
                end;

              if _5chargertext.est_dehors and _5jouer.est_dedans then
                begin
                  _5jouer.faire_sortir;
                  num_menu := goto_menu;
                end;         

              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                and (mouse_y > heigth div 4 - 35) and (mouse_y < heigth div 4 + 5) then
                  begin
                    if not was_played then
                      begin
                        survol.play;
                        was_played := true;
                      end;
                    _5map.pause
                  end
                else
                  if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                    and (mouse_y > heigth div 4) and (mouse_y < heigth div 4 + 30) then
                      begin
                        if not was_played then
                          begin
                            survol.play;
                            was_played := true;
                          end;
                        _5maptext.pause
                      end
                    else
                      if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                        and (mouse_y > 2 * heigth div 4 - 35) and (mouse_y < 2 * heigth div 4 + 5) then
                          begin
                            if not was_played then
                              begin
                                survol.play;
                                was_played := true;
                              end;
                            _5charger.pause
                          end
                        else
                          if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                            and (mouse_y > 2 * heigth div 4) and (mouse_y < 2 * heigth div 4 + 30) then
                              begin
                                if not was_played then
                                  begin
                                    survol.play;
                                    was_played := true;
                                  end;
                                _5chargertext.pause
                              end
                            else
                              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                                and (mouse_y > 3 * heigth div 4 - 15) and (mouse_y < 3 * heigth div 4 + 15) then
                                  begin
                                    if not was_played then
                                      begin
                                        survol.play;
                                        was_played := true;
                                      end;
                                    _5jouer.pause
                                  end
                                else
                                  begin
                                    _5map.play;
                                    _5maptext.play;
                                    _5charger.play;
                                    _5chargertext.play;
                                    _5jouer.play;
                                    was_played := false;
                                  end;

              _5map.render;
              _5maptext.render;
              _5charger.render;
              _5chargertext.render;
              _5jouer.render;
              solo_map.text_render;
              solo_charge.text_render;
        end;
        6 : begin
          //QUITTER
              if not _1quitter.est_dehors then
                begin
                  _1quitter.render;
                  Exit;
                end;

              if not _2serveur.est_dehors then
                begin
                  _2serveur.render;
                  Exit;
                end;

              if not _3jouer.est_dehors then
                begin
                  _3jouer.render;
                  Exit;
                end;

              if not _4jouer.est_dehors then
                begin
                  _4jouer.render;
                  Exit;
                end;

              if not _5jouer.est_dehors then
                begin
                  _5jouer.render;
                  Exit;
                end;

              if not _7apply.est_dehors then
                begin
                  _7apply.render;
                  Exit;
                end;


              if _retour.est_dedans then
                _retour.faire_sortir;

              if is_in_menu <> 6 then
                _6quitter.faire_venir;

              is_in_menu := 6;

              if _6quitter.est_dedans and _6oui.est_dehors then
                _6oui.faire_venir;

              if _6oui.est_dedans and _6non.est_dehors then
                _6non.faire_venir;

              if _6quitter.est_dehors and _6oui.est_dedans then
                _6oui.faire_sortir;

              if _6oui.est_dehors and _6non.est_dedans then
                begin
                  num_menu := goto_menu;
                  _6non.faire_sortir;
                end; 

              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                and (mouse_y > heigth div 3 - 15) and (mouse_y < heigth div 3 + 15) then
                  begin
                    if not was_played then
                      begin
                        survol.play;
                        was_played := true;
                      end;
                    _6quitter.pause
                  end
                else
                  if (mouse_x > width div 2 - 140) and (mouse_x < width div 2 - 5)
                    and (mouse_y > 2 * heigth div 3 - 15) and (mouse_y < 2 * heigth div 3 + 15) then
                      begin
                        if not was_played then
                          begin
                            survol.play;
                            was_played := true;
                          end;
                        _6oui.pause
                      end
                    else
                      if (mouse_x > width div 2 + 5) and (mouse_x < width div 2 + 140)
                        and (mouse_y > 2 * heigth div 3 - 15) and (mouse_y < 2 * heigth div 3 + 15) then
                          begin
                            if not was_played then
                              begin
                                survol.play;
                                was_played := true;
                              end;
                            _6non.pause
                          end
                        else
                          begin
                            _6non.play;
                            _6quitter.play;
                            _6oui.play;
                            was_played := false;
                          end;

              _6quitter.render;
              _6oui.render;
              _6non.render;
        end;
        7 : begin
            //OPTIONSSS

              if not _1quitter.est_dehors then
                begin
                  _1quitter.render;
                  Exit;
                end;

              if not _2serveur.est_dehors then
                begin
                  _2serveur.render;
                  Exit;
                end;

              if not _3jouer.est_dehors then
                begin
                  _3jouer.render;
                  Exit;
                end;

              if not _4jouer.est_dehors then
                begin
                  _4jouer.render;
                  Exit;
                end;

              if not _5jouer.est_dehors then
                begin
                  _5jouer.render;
                  Exit;
                end;

              if not _6non.est_dehors then
                begin
                  _6non.render;
                  Exit;
                end;


              if not _8jouer.est_dehors then
                begin
                  _8jouer.render;
                  Exit;
                end;

              if _retour.est_dehors then
                _retour.faire_venir;

              if is_in_menu <> 7 then
                _7resolution.faire_venir;

              is_in_menu := 7;


              if _7resolution.est_dedans and _7resolutiontext.est_dehors then
                _7resolutiontext.faire_venir;

              if _7resolutiontext.est_dedans and _7resolutiondroit.est_dehors then
                begin
                  _7resolutiondroit.faire_venir;
                  text_resol.set_coord(trunc(width div 2 - 100), trunc(heigth div 5 - 5));
                  text_resol.set_visible(true);
                end;

              if _7resolutiondroit.est_dedans and _7resolutiongauche.est_dehors then
                _7resolutiongauche.faire_venir;

              if _7resolutiongauche.est_dedans and _7son.est_dehors then
                _7son.faire_venir;

              if _7son.est_dedans and _7sonoui.est_dehors then
                _7sonoui.faire_venir;

              if _7sonoui.est_dedans and _7sonnon.est_dehors then
                _7sonnon.faire_venir;

              if _7sonnon.est_dedans and _7fog.est_dehors then
                _7fog.faire_venir;

              if _7fog.est_dedans and _7fogtext.est_dehors then
                _7fogtext.faire_venir;

              if _7fogtext.est_dedans and _7fogdroit.est_dehors then
                begin
                  _7fogdroit.faire_venir;
                  text_fog.set_coord(trunc(width div 2 - 100), trunc(3 * heigth div 5 - 5));
                  text_fog.set_visible(true);
                end;

              if _7fogdroit.est_dedans and _7foggauche.est_dehors then
                _7foggauche.faire_venir;

              if _7foggauche.est_dedans and _7ok.est_dehors then
                _7ok.faire_venir;

              if _7ok.est_dedans and _7annuler.est_dehors then
                _7annuler.faire_venir;

              if _7annuler.est_dedans and _7apply.est_dehors then
                _7apply.faire_venir;



              if _7resolution.est_dehors and _7resolutiontext.est_dedans then
                begin
                  _7resolutiontext.faire_sortir;
                  text_resol.set_visible(false);
                end;

              if _7resolutiontext.est_dehors and _7resolutiondroit.est_dedans then
                _7resolutiondroit.faire_sortir;

              if _7resolutiondroit.est_dehors and _7resolutiongauche.est_dedans then
                _7resolutiongauche.faire_sortir;

              if _7resolutiongauche.est_dehors and _7son.est_dedans then
                _7son.faire_sortir;

              if _7son.est_dehors and _7sonoui.est_dedans then
                _7sonoui.faire_sortir;

              if _7sonoui.est_dehors and _7sonnon.est_dedans then
                _7sonnon.faire_sortir;

              if _7sonnon.est_dehors and _7fog.est_dedans then
                _7fog.faire_sortir;

              if _7fog.est_dehors and _7fogtext.est_dedans then
                begin
                  _7fogtext.faire_sortir;
                  text_fog.set_visible(false);
                end;

              if _7fogtext.est_dehors and _7fogdroit.est_dedans then
                _7fogdroit.faire_sortir;

              if _7fogdroit.est_dehors and _7foggauche.est_dedans then
                _7foggauche.faire_sortir;

              if _7foggauche.est_dehors and _7ok.est_dedans then
                _7ok.faire_sortir;

              if _7ok.est_dehors and _7annuler.est_dedans then
                _7annuler.faire_sortir;

              if _7annuler.est_dehors and _7apply.est_dedans then
                begin
                  _7apply.faire_sortir;
                  num_menu := goto_menu;
                end;


              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                and (mouse_y > heigth div 5 - 35) and (mouse_y < heigth div 5 - 5) then
                  begin
                    if not was_played then
                      begin
                        survol.play;
                        was_played := true;
                      end;
                    _7resolution.pause
                  end
                else
                  if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                    and (mouse_y > heigth div 5) and (mouse_y < heigth div 5 + 30) then
                      begin
                        if not was_played then
                          begin
                            survol.play;
                            was_played := true;
                          end;
                        _7resolutiontext.pause
                      end
                   else
                    if (mouse_x > width div 2 + 110) and (mouse_x < width div 2 + 140)
                      and (mouse_y > heigth div 5) and (mouse_y < heigth div 5 + 30) then
                        begin
                          if not was_played then
                            begin
                              survol.play;
                              was_played := true;
                            end;
                          _7resolutiondroit.pause
                        end
                      else
                        if (mouse_x > width div 2 - 140) and (mouse_x < width div 2 - 110)
                          and (mouse_y > heigth div 5) and (mouse_y < heigth div 5 + 30) then
                            begin
                              if not was_played then
                                begin
                                  survol.play;
                                  was_played := true;
                                end;
                              _7resolutiongauche.pause
                            end
                      else
                      if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                        and (mouse_y > 2 * heigth div 5 - 35) and (mouse_y < 2 * heigth div 5 - 5) then
                          begin
                            if not was_played then
                              begin
                                survol.play;
                                was_played := true;
                              end;
                            _7son.pause
                          end
                        else
                          if (mouse_x > width div 2 - 140) and (mouse_x < width div 2 - 5)
                            and (mouse_y > 2 * heigth div 5) and (mouse_y < 2 * heigth div 5 + 30) then
                              begin
                                if not was_played then
                                  begin
                                    survol.play;
                                    was_played := true;
                                  end;
                                _7sonoui.pause
                              end
                            else
                              if (mouse_x > width div 2 + 5) and (mouse_x < width div 2 + 140)
                                and (mouse_y > 2 * heigth div 5) and (mouse_y < 2 * heigth div 5 + 30) then
                                  begin
                                    if not was_played then
                                      begin
                                        survol.play;
                                        was_played := true;
                                      end;
                                    _7sonnon.pause
                                  end
                                else
                                  if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                                    and (mouse_y > 3 * heigth div 5 - 35) and (mouse_y < 3 * heigth div 5 - 5) then
                                      begin
                                        if not was_played then
                                          begin
                                            survol.play;
                                            was_played := true;
                                          end;
                                        _7fog.pause
                                      end
                                    else
                                     if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                                      and (mouse_y > 3 * heigth div 5) and (mouse_y < 3 * heigth div 5 + 30) then
                                        begin
                                          if not was_played then
                                            begin
                                              survol.play;
                                              was_played := true;
                                            end;
                                          _7fogtext.pause
                                        end
                                      else
                                        if (mouse_x > width div 2 + 110) and (mouse_x < width div 2 + 140)
                                          and (mouse_y > 3 * heigth div 5) and (mouse_y < 3 * heigth div 5 + 30) then
                                            begin
                                              if not was_played then
                                                begin
                                                  survol.play;
                                                  was_played := true;
                                                end;
                                              _7fogdroit.pause
                                            end
                                          else
                                            if (mouse_x > width div 2 - 140) and (mouse_x < width div 2 - 110)
                                              and (mouse_y > 3 * heigth div 5) and (mouse_y < 3 * heigth div 5 + 30) then
                                                begin
                                                  if not was_played then
                                                    begin
                                                      survol.play;
                                                      was_played := true;
                                                    end;
                                                  _7foggauche.pause
                                                end
                                              else
                                                if (mouse_x > width div 2 - 68) and (mouse_x < width div 2 + 68)
                                                  and (mouse_y > 4 * heigth div 5 - 50) and (mouse_y < 4 * heigth div 5 - 20) then
                                                    begin
                                                      if not was_played then
                                                        begin
                                                          survol.play;
                                                          was_played := true;
                                                        end;
                                                      _7ok.pause
                                                    end
                                                  else
                                                    if (mouse_x > width div 2 - 68) and (mouse_x < width div 2 + 68)
                                                      and (mouse_y > 4 * heigth div 5 - 15) and (mouse_y < 4 * heigth div 5 + 15) then
                                                        begin
                                                          if not was_played then
                                                            begin
                                                              survol.play;
                                                              was_played := true;
                                                            end;
                                                          _7annuler.pause
                                                        end
                                                      else
                                                        if (mouse_x > width div 2 - 68) and (mouse_x < width div 2 + 68)
                                                          and (mouse_y > 4 * heigth div 5 + 20) and (mouse_y < 4 * heigth div 5 + 50) then
                                                            begin
                                                              if not was_played then
                                                                begin
                                                                  survol.play;
                                                                  was_played := true;
                                                                end;
                                                              _7apply.pause
                                                            end
                                                          else
                                                            begin
                                                              _7resolution.play;
                                                              _7resolutiontext.play;
                                                              _7resolutiondroit.play;
                                                              _7resolutiongauche.play;
                                                              _7son.play;
                                                              _7sonoui.play;
                                                              _7sonnon.play;
                                                              _7fog.play;
                                                              _7fogtext.play;
                                                              _7fogdroit.play;
                                                              _7foggauche.play;
                                                              _7ok.play;
                                                              _7annuler.play;
                                                              _7apply.play;
                                                              was_played := false;
                                                            end;

              _7resolution.render;
              _7resolutiontext.render;
              _7resolutiondroit.render;
              _7resolutiongauche.render;
              _7son.render;
              _7sonnon.render;
              _7sonoui.render;
              _7fog.render;
              _7fogtext.render;
              _7fogdroit.render;
              _7foggauche.render;
              _7foggauche.render;
              _7ok.render;
              _7annuler.render;
              _7apply.render;
              text_resol.text_render;
              text_fog.text_render;
        end;
        8 : begin

               if not _1quitter.est_dehors then
                begin
                  _1quitter.render;
                  Exit;
                end;

              if not _2serveur.est_dehors then
                begin
                  _2serveur.render;
                  Exit;
                end;

              if not _3jouer.est_dehors then
                begin
                  _3jouer.render;
                  Exit;
                end;

              if not _4jouer.est_dehors then
                begin
                  _4jouer.render;
                  Exit;
                end;

              if not _5jouer.est_dehors then
                begin
                  _5jouer.render;
                  Exit;
                end;

              if not _6non.est_dehors then
                begin
                  _6non.render;
                  Exit;
                end;

              if not _7apply.est_dehors then
                begin
                  _7apply.render;
                end;
              

              if _retour.est_dehors then
                _retour.faire_venir;

              if is_in_menu <> 8 then
                case num_player of
                  1 : _8titou.faire_venir;
                  2 : _8clad.faire_venir;
                  3 : _8xoy.faire_venir;
                  4 : _8mouton.faire_venir;
                end;

              is_in_menu := 8;

              case num_player of
                1 : if _8titou.est_dedans and _8droit.est_dehors then
                      _8droit.faire_venir;
                2 : if _8clad.est_dedans and _8droit.est_dehors then
                      _8droit.faire_venir;
                3 : if _8xoy.est_dedans and _8droit.est_dehors then
                      _8droit.faire_venir;
                4 : if _8mouton.est_dedans and _8droit.est_dehors then
                      _8droit.faire_venir;
              end;

              if _8droit.est_dedans and _8gauche.est_dehors then
                begin
                  _8gauche.faire_venir;
                  _8titou.set_in;
                  _8clad.faire_venir;
                  _8clad.set_in;
                  _8xoy.faire_venir;
                  _8xoy.set_in;
                  _8mouton.faire_venir;
                  _8mouton.set_in;
                end;

              if _8gauche.est_dedans and _8jouer.est_dehors then
                _8jouer.faire_venir;

              case num_player of
                1 : if _8titou.est_dehors and _8droit.est_dedans then
                      _8droit.faire_sortir;
                2 : if _8clad.est_dehors and _8droit.est_dedans then
                      _8droit.faire_sortir;
                3 : if _8xoy.est_dehors and _8droit.est_dedans then
                      _8droit.faire_sortir;
                4 : if _8mouton.est_dehors and _8droit.est_dedans then
                      _8droit.faire_sortir;
              end;

              if _8droit.est_dehors and _8gauche.est_dedans then
                _8gauche.faire_sortir;

              if _8gauche.est_dehors and _8jouer.est_dedans then
                begin
                  _8jouer.faire_sortir;
                  num_menu := goto_menu;
                end;
              if (mouse_x > width div 2 - 97) and (mouse_x < width div 2 + 97)
                  and (mouse_y > 150) and (mouse_y < 405) then
                    begin
                      if num_player = 1 then
                        _8titou.pause
                        else
                        if num_player = 2 then
                          _8clad.pause
                          else
                          if num_player = 3 then
                            _8xoy.pause
                            else
                            _8mouton.pause;
                    end
                    else
                if (mouse_x > width div 2 + 107) and (mouse_x < width div 2 + 137)
                  and (mouse_y > 277) and (mouse_y < 307) then
                  begin
                    if not was_played then
                      begin
                        survol.play;
                        was_played := true;
                      end;
                    _8droit.pause;
                  end
                  else
                    if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 - 107)
                        and (mouse_y > 277) and (mouse_y < 307) then
                        begin
                          if not was_played then
                            begin
                              survol.play;
                              was_played := true;
                            end;
                          _8gauche.pause;
                        end
                        else
                          if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                            and (mouse_y > 420) and (mouse_y < 450) then
                            begin
                              if not was_played then
                                begin
                                  survol.play;
                                  was_played := true;
                                end;
                              _8jouer.pause;
                            end
                            else
                              begin
                                _8droit.play;
                                _8gauche.play;
                                _8jouer.play;
                                _8titou.play;
                                _8clad.play;
                                _8xoy.play;
                                _8mouton.play;
                                was_played := false;
                              end;

                if num_player = 1 then                
                  _8titou.render
                  else
                  if num_player = 2 then
                    _8clad.render
                    else
                    if num_player = 3 then
                      _8xoy.render
                      else
                      _8mouton.render;

              _8droit.render;
              _8gauche.render;
              _8jouer.render;
        end;
      end;
      if (num_menu <> 1) and (num_menu <> 6)
          and (mouse_x > width - 200) and (mouse_x < width - 20)
          and (mouse_y > heigth - 80) and (mouse_y < heigth - 50) then
            begin
              if not was_played_retour then
                begin
                  survol.play;
                  was_played_retour := true;
                end;
              _retour.pause;
            end
            else
            begin
              _retour.play;
              was_played_retour := false;
            end;                        
      _retour.render;
    end;


  procedure c_menu.render_text;
  begin
    client_pseudo.text_render;
    client_ipserveur.text_render;
    serveur_map.text_render;
    serveur_pseudo.text_render;
    solo_charge.text_render;
    solo_map.text_render;
  end;

  procedure c_menu.on_click(mouse_x: Integer; mouse_y: Integer);
    begin

      mouse_x := mouse_x + 10;
      mouse_y := mouse_y + 10;

      if (num_menu <> 1) and (num_menu <> 6) then
          if (mouse_x > width - 200) and (mouse_x < width - 20)
              and (mouse_y > heigth - 80) and (mouse_y < heigth - 50) then
              begin
                focus := 'none';
                case num_menu of
                  2 : begin
                        _2client.faire_sortir;
                        goto_menu := 1;
                  end;
                  3 : begin
                        _3pseudo.faire_sortir;
                        goto_menu := 2;
                  end;
                  4 : begin
                        _4pseudo.faire_sortir;
                        goto_menu := 2;
                  end;
                  5 : begin
                        _5map.faire_sortir;
                        goto_menu := 1;
                  end;
                  7 : begin
                        _7resolution.faire_sortir;
                        goto_menu := 1;
                  end;
                  8 : begin
                    case num_player of
                      1 : _8titou.faire_sortir;
                      2 : _8clad.faire_sortir;
                      3 : _8xoy.faire_sortir;
                      4 : _8mouton.faire_sortir;
                    end;
                    goto_menu := 5;
                  end;
                end;
              end;
      


      case num_menu of
        1 : begin
            if (mouse_x > 15) and (mouse_x < 152)
              and (mouse_y > 15) and (mouse_y < 45) then
                WinExec('site.bat', 0)
                else
              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                 and (mouse_y > heigth div 5 - 15) and (mouse_y < heigth div 5 + 15) then
                 begin
                   _1solo.faire_sortir;
                   goto_menu := 5;
                 end
               else
                 if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                    and (mouse_y > 2 * heigth div 5 - 15) and (mouse_y < 2 * heigth div 5 + 15) then
                    begin
                      _1solo.faire_sortir;
                      goto_menu := 2;
                    end
                  else
                    if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                       and (mouse_y > 3 * heigth div 5 - 15) and (mouse_y < 3 * heigth div 5 + 15) then
                       begin
                         _1solo.faire_sortir;
                         goto_menu := 7;
                       end
                    else
                      if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                         and (mouse_y > 4 * heigth div 5 - 15) and (mouse_y < 4 * heigth div 5 + 15) then
                    begin
                      _1solo.faire_sortir;
                      goto_menu := 6;
                    end;
              end;
      end;
         case num_menu of
        //Le menu multi
        2 : begin
              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                 and (mouse_y > heigth div 3 - 15) and (mouse_y < heigth div 3 + 15) then
                  begin
                    _2client.faire_sortir;
                    goto_menu := 3;
                  end
                  else
                    if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                       and (mouse_y > 2 * heigth div 3 - 15) and (mouse_y < 2 * heigth div 3 + 15) then
                        begin
                          _2client.faire_sortir;
                          goto_menu := 4;
                        end;
       end;
        //Le menu du CXlient
        3 : begin
           //On gere le focus!
                 if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                    and (mouse_y > heigth div 4) and (mouse_y < heigth div 4 + 30) then
                      begin
                        focus := 'client_pseudo';
                        clik.play;
                      end
                    else
                         if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                          and (mouse_y > 2 * heigth div 4) and (mouse_y < 2 * heigth div 4 + 30) then
                            begin
                              focus := 'client_ip';
                              clik.play;
                            end
                          else
                          if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                            and (mouse_y > 3 * heigth div 4 - 15) and (mouse_y < 3 * heigth div 4 + 15) then
                              begin
                                _3pseudo.faire_sortir;
                                _3pseudo.set_out;
                                _3pseudotext.faire_sortir;
                                _3pseudotext.set_out;
                                _3ip.faire_sortir;
                                _3ip.set_out;
                                _3iptext.faire_sortir;
                                _3iptext.set_out;
                                _3jouer.faire_sortir;
                                _3jouer.set_out;
                               clik.play;
                               hide_text;
                               num_menu := 0;
                               myform.show_cursor(false);
                               is_actif := false;
                               myplayer := c_player.create('c', client_pseudo.get_text, client_ipserveur.get_text);
                               myplayer.load_player(test);
                               myplayer.connection;
                              end
                              else
                                focus := 'none';
        //       NE PAS OUBLIER DE CACHER

        end;
       //Le menu du serveur
       4 : begin
           //On gere le focus!
                  if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                    and (mouse_y > heigth div 4) and (mouse_y < heigth div 4 + 30) then
                      begin
                        focus := 'serveur_pseudo';
                        clik.play;
                      end
                    else
                          if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                            and (mouse_y > 2 * heigth div 4) and (mouse_y < 2 * heigth div 4 + 30) then
                              begin
                                focus := 'serveur_map';
                                clik.play;
                              end
                            else
                              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                                and (mouse_y > 3 * heigth div 4 - 15) and (mouse_y < 3 * heigth div 4 + 15) then
                                  begin
                                    if (FileExists(serveur_map.get_text)) then
                                     begin
                                       _4pseudo.faire_sortir;
                                       _4pseudo.set_out;
                                       _4pseudotext.faire_sortir;
                                       _4pseudotext.set_out;
                                       _4map.faire_sortir;
                                       _4map.set_out;
                                       _4maptext.faire_sortir;
                                       _4maptext.set_out;
                                       _4jouer.faire_sortir;
                                       _4jouer.set_out;
                                       clik.play;
                                       hide_text;
                                       num_menu := 0;
                                       is_actif := false;
                                       myplayer := c_player.create('s', serveur_pseudo.get_text, serveur_map.get_text);
                                       myplayer.load_player(test);
                                       myplayer.connection;
                                       myform.show_cursor(false);
                                       myennemis := c_ennemis.create;
                                       myennemis.tableaux(mymesh.dep_eta.etage, mymesh.map2);
                                       mymenu_in_game := c_menu_in_game.create(test, myplayer.carac, myplayer.tab_contenu);
                                     end
                                     else
                                      serveur_map.change_text('');
                                  end
                                else
                                  focus := 'none';
       end;



       //Le menu du solo
       5 : begin

                  if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                    and (mouse_y > heigth div 4) and (mouse_y < heigth div 4 + 30) then
                      begin
                        focus := 'solo_map';
                        clik.play;
                      end
                    else
                          if (mouse_x > width div 2 - 107) and (mouse_x < width div 2 + 107)
                            and (mouse_y > 2 * heigth div 4) and (mouse_y < 2 * heigth div 4 + 30) then
                              begin
                                focus := 'solo_charger';
                                clik.play;
                              end
                            else
                              if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                                and (mouse_y > 3 * heigth div 4 - 15) and (mouse_y < 3 * heigth div 4 + 15) then
                                  begin
                                    goto_menu := 8;
                                    _5map.faire_sortir;
                                  end
                                else
                                  focus := 'none';

       end;
       6 : begin
        //Le menu quitter
                if (mouse_x > width div 2 - 140) and (mouse_x < width div 2 - 5)
                    and (mouse_y > 2 * heigth div 3 - 15) and (mouse_y < 2 * heigth div 3 + 15) then
                      begin
                        Application.Exit;
                        Exit;
                      end
                    else
                      if (mouse_x > width div 2 + 5) and (mouse_x < width div 2 + 140)
                        and (mouse_y > 2 * heigth div 3 - 15) and (mouse_y < 2 * heigth div 3 + 15) then
                          begin
                            _6quitter.faire_sortir;
                            goto_menu := 1;
                          end
                        else
                          focus := 'none';
       end;
       7 : begin

                    if (mouse_x > width div 2 + 110) and (mouse_x < width div 2 + 140)
                      and (mouse_y > heigth div 5) and (mouse_y < heigth div 5 + 30) then
                        begin
                          num_resol := num_resol + 1;
                          if num_resol > High(resol) then
                            num_resol := High(resol);
                          text_resol.change_text(Resol[num_resol]);
                          clik.play;
                        end
                      else
                        if (mouse_x > width div 2 - 140) and (mouse_x < width div 2 - 110)
                          and (mouse_y > heigth div 5) and (mouse_y < heigth div 5 + 30) then
                            begin
                              num_resol := num_resol - 1;
                              if num_resol < Low(resol) then
                                num_resol := Low(resol);
                              text_resol.change_text(Resol[num_resol]);
                              clik.play;
                            end
                      else
                          if (mouse_x > width div 2 - 140) and (mouse_x < width div 2 - 5)
                            and (mouse_y > 2 * heigth div 5) and (mouse_y < 2 * heigth div 5 + 30) then
                              begin
                                //Activer les sons ici!!!!!!!!!!!!!!
                                clik.entendre(true);
                                survol.entendre(true);
                              end
                            else
                              if (mouse_x > width div 2 + 5) and (mouse_x < width div 2 + 140)
                                and (mouse_y > 2 * heigth div 5) and (mouse_y < 2 * heigth div 5 + 30) then
                                  begin
                                    //désactiver les sons ici!!!!!!!!!!!!!!
                                    clik.entendre(false);
                                    survol.entendre(false);
                                  end
                                else
                                        if (mouse_x > width div 2 + 110) and (mouse_x < width div 2 + 140)
                                          and (mouse_y > 3 * heigth div 5) and (mouse_y < 3 * heigth div 5 + 30) then
                                            begin
                                              num_fog := num_fog + 1;
                                              if num_fog > High(fog_val) then
                                                num_fog := High(fog_val);
                                              text_fog.change_text(fog_val[num_fog]);
                                              dist_fog := StrToInt(fog_val[num_fog]);
                                              clik.play;
                                            end
                                          else
                                            if (mouse_x > width div 2 - 140) and (mouse_x < width div 2 - 110)
                                              and (mouse_y > 3 * heigth div 5) and (mouse_y < 3 * heigth div 5 + 30) then
                                                begin
                                                  num_fog := num_fog - 1;
                                                  if num_fog < Low(fog_val) then
                                                    num_fog := Low(fog_val);
                                                  text_fog.change_text(fog_val[num_fog]);
                                                  dist_fog := StrToInt(fog_val[num_fog]);
                                                  clik.play;
                                                end
                                              else
                                                if (mouse_x > width div 2 - 68) and (mouse_x < width div 2 + 68)
                                                  and (mouse_y > 4 * heigth div 5 - 50) and (mouse_y < 4 * heigth div 5 - 20) then
                                                    begin
                                                      goto_menu := 1;
                                                      _7resolution.faire_sortir;
                                                      case num_resol of
                                                        0 : begin
                                                              myform.change_size(800, 600);
                                                              myform.set_max(false);
                                                        end;
                                                        1 : begin;
                                                              myform.change_size(1024, 768);
                                                              myform.set_max(false);
                                                        end;
                                                        2 : begin
                                                              myform.change_size(1280, 800);
                                                              myform.set_max(false);
                                                        end;
                                                        3 : begin
                                                              myform.change_size(1280, 960);
                                                              myform.set_max(false);
                                                        end;
                                                        4 : begin
                                                              myform.change_size(1680, 1050);
                                                              myform.set_max(false);
                                                        end;
                                                        5 : begin
                                                              myform.set_max(true);
                                                        end;
                                                      end;
                                                      clik.play;
                                                    end
                                                  else
                                                    if (mouse_x > width div 2 - 68) and (mouse_x < width div 2 + 68)
                                                      and (mouse_y > 4 * heigth div 5 - 15) and (mouse_y < 4 * heigth div 5 + 15) then
                                                        begin
                                                          goto_menu := 1;
                                                          _7resolution.faire_sortir;
                                                          clik.play;
                                                        end
                                                      else
                                                        if (mouse_x > width div 2 - 68) and (mouse_x < width div 2 + 68)
                                                          and (mouse_y > 4 * heigth div 5 + 20) and (mouse_y < 4 * heigth div 5 + 50) then
                                                            begin
                                                              case num_resol of
                                                                0 : begin
                                                                      myform.change_size(800, 600);
                                                                      myform.set_max(false);
                                                                end;
                                                                1 : begin;
                                                                      myform.change_size(1024, 768);
                                                                      myform.set_max(false);
                                                                end;
                                                                2 : begin
                                                                      myform.change_size(1280, 800);
                                                                      myform.set_max(false);
                                                                end;
                                                                3 : begin
                                                                      myform.change_size(1280, 960);
                                                                      myform.set_max(false);
                                                                end;
                                                                4 : begin
                                                                      myform.change_size(1680, 1050);
                                                                      myform.set_max(false);
                                                                end;
                                                                5 : begin
                                                                      myform.set_max(True);
                                                                end;
                                                                    end;
                                                                clik.play;
                                                            end;

       end;
       8 : begin
         
              if (mouse_x > width div 2 + 107) and (mouse_x < width div 2 + 137)
                  and (mouse_y > 277) and (mouse_y < 307) then
                  begin
                    num_player := num_player + 1;
                    if num_player > 4 then
                      num_player := 4;
                    clik.play;
                  end
                  else
                    if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 - 107)
                      and (mouse_y > 277) and (mouse_y < 307) then
                        begin
                          num_player := num_player - 1;
                          if num_player < 1 then
                            num_player := 1;
                          clik.play;
                        end
                        else
                          if (mouse_x > width div 2 - 137) and (mouse_x < width div 2 + 137)
                            and (mouse_y > 420) and (mouse_y < 450) then
                              begin
                                if (select_map) and (FileExists(solo_map.get_text)) then
                                 begin
                                   hide_text;
                                   num_menu := 0;
                                   is_actif := false;
                                   myplayer := c_player.create('o', '', solo_map.get_text);
                                   myplayer.particle := tparticle.create(test);
                                   myform.show_cursor(false);
                                   myennemis := c_ennemis.create;
                                   myennemis.tableaux(mymesh.dep_eta.etage, mymesh.map2);
                                   mygamemenu := c_gamemenu.create(myform._3D_device, myform.Height, myform.Width);
                                   mygamemenu.onresize(myform.Width, myform.Height);
                                   mymenu_in_game := c_menu_in_game.create(test, myplayer.carac, myplayer.tab_contenu);
                                 end
                                 else
                                  solo_map.change_text('');
                               clik.play;
                              end;
       end;
         end;
    end;


    function c_menu.show_menu : boolean;
      begin
        Result := is_actif;
      end;

    procedure c_menu.on_key(b: integer);
    var
      buf : string;
      buf_text : u_text;
    begin
      if focus <> 'none' then
        begin
          if focus = 'solo_map' then
            buf_text := solo_map;
          if focus = 'solo_charger' then
            buf_text := solo_charge;
          if focus = 'client_ip' then
            buf_text := client_ipserveur;
          if focus = 'client_pseudo' then
            buf_text := client_pseudo;
          if focus = 'serveur_map' then
            buf_text := serveur_map;
          if focus = 'serveur_pseudo' then
            buf_text := serveur_pseudo;

          buf := buf_text.get_text;
          if (b = 8) and (Length(buf) > 0) then
            begin
              if Length(buf) > 0 then
                begin
                  SetLength(buf, length(buf) - 1);
                  buf_text.change_text(buf);
                end;
            end
            else
            begin
              buf_text.change_text(buf + int_to_char(b));
            end;
        end;
      end;


    procedure c_menu.hide_text;
    begin
      solo_charge.set_visible(False);
      solo_map.set_visible(False);
      serveur_map.set_visible(False);
      serveur_pseudo.set_visible(False);
      client_pseudo.set_visible(False);
      client_ipserveur.set_visible(False);
    end;

    function c_menu.int_to_char(key_: Integer) : char;
    begin
     if key_ = 190 then
        Result := '.'
        else
        if GetKeyState(VK_CAPITAL) = 0 then
          begin
            if key_ in [32..126] then
              begin
                if key_ in [65..91] then
                  key_ := key_ + 32;
                Result := chr(key_)
              end;
          end
          else
          if key_ in [32..126] then
            Result := chr(key_)
            else
            Result := '*';
    end;

    function c_menu.is_active;
    begin
      Result := is_actif;
    end;

    procedure c_menu.onresize(_width: Integer; _heigth: Integer);
      begin
        width := _width;
        heigth := _heigth;


        solo_map.set_coord(width * 380 div 800, heigth * 185 div 600);
        serveur_map.set_coord(width * 385 div 800, heigth * 270 div 600);
        solo_charge.set_coord(width * 315 div 800, heigth * 270 div 600);
        client_pseudo.set_coord(width * 316 div 800, heigth * 185 div 600);
        text_fog.set_coord(trunc(width div 2 - 100), trunc(3 * heigth div 5 - 5));
        text_resol.set_coord(trunc(width div 2 - 100), trunc(heigth div 5 - 5));

        solo_charge.set_coord(trunc(width div 2 - 100), trunc(2 * heigth div 4 - 5));
        solo_map.set_coord(trunc(width div 2 - 100), trunc(heigth div 4 - 5));
        client_pseudo.set_coord(trunc(width div 2 - 100), trunc(heigth div 4 - 5));
        client_ipserveur.set_coord(trunc(width div 2 - 100), trunc(2 * heigth div 4 - 5));
        serveur_map.set_coord(trunc(width div 2 - 100), trunc(2 * heigth div 4 - 5));
        serveur_map.set_coord(trunc(width div 2 - 100), trunc(heigth div 4 - 5));

        _1solo.change_resolution(_width, _heigth, _width div 2 - 137, _heigth div 5 - 15);
        _1multi.change_resolution(_width, _heigth, _width div 2 - 137, 2 * _heigth div 5 - 15);
        _1option.change_resolution(_width, _heigth, _width div 2 - 137, 3 * _heigth div 5 - 15);
        _1quitter.change_resolution(_width, _heigth, _width div 2 - 137, 4 * _heigth div 5 - 15);

        _2client.change_resolution(_width, _heigth, _width div 2 - 137, _heigth div 3 - 15);
        _2serveur.change_resolution(_width, _heigth, _width div 2 - 137, 2 * _heigth div 3 - 15);

        _3pseudo.change_resolution(_width, _heigth, _width div 2 - 137, _heigth div 4 - 35);
        _3pseudotext.change_resolution(_width, _heigth, _width div 2 - 107, _heigth div 4);
        _3ip.change_resolution(_width, _heigth, _width div 2 - 137, 2 * _heigth div 4 - 35);
        _3iptext.change_resolution(_width, _heigth, _width div 2 - 107, 2 * _heigth div 4);
        _3jouer.change_resolution(_width, _heigth, _width div 2 - 137, 3 * _heigth div 4 - 15);

        _4pseudo.change_resolution(_width, _heigth, _width div 2 - 137, _heigth div 4 - 35);
        _4pseudotext.change_resolution(_width, _heigth, _width div 2 - 107, _heigth div 4);
        _4map.change_resolution(_width, _heigth, _width div 2 - 137, 2 * _heigth div 4 - 35);
        _4maptext.change_resolution(_width, _heigth, _width div 2 - 107, 2 * _heigth div 4);
        _4jouer.change_resolution(_width, _heigth, _width div 2 - 137, 3 * _heigth div 4 - 15);

        _5map.change_resolution(_width, _heigth, _width div 2 - 137, _heigth div 4 - 35);
        _5maptext.change_resolution(_width, _heigth, _width div 2 - 107, _heigth div 4);
        _5charger.change_resolution(_width, _heigth, _width div 2 - 137, 2 * _heigth div 4 - 35);
        _5chargertext.change_resolution(_width, _heigth, _width div 2 - 107, 2 * _heigth div 4);
        _5jouer.change_resolution(_width, _heigth, _width div 2 - 137, 3 * _heigth div 4 - 15);

        _6quitter.change_resolution(_width, _heigth, _width div 2 - 137, _heigth div 3 - 15);
        _6oui.change_resolution(_width, _heigth, _width div 2 - 140, 2 * _heigth div 3 - 15);
        _6non.change_resolution(_width, _heigth, _width div 2 + 5, 2 * _heigth div 3 - 15);

        _7resolution.change_resolution(_width, _heigth, _width div 2 - 137, _heigth div 5 - 35);
        _7resolutiontext.change_resolution(_width, _heigth, _width div 2 - 107, _heigth div 5);
        _7son.change_resolution(_width, _heigth, _width div 2 - 137, 2 * _heigth div 5 - 35);
        _7sonoui.change_resolution(_width, _heigth, _width div 2 - 140, 2 * _heigth div 5);
        _7sonnon.change_resolution(_width, _heigth, _width div 2 + 5, 2 * _heigth div 5);
        _7fog.change_resolution(_width, _heigth, _width div 2 - 137, 3 * _heigth div 5 - 35);
        _7fogtext.change_resolution(_width, _heigth, _width div 2 - 107, 3 * _heigth div 5);
        _7fogdroit.change_resolution(_width, _heigth, _width div 2 + 110, 3 * _heigth div 5);
        _7foggauche.change_resolution(_width, _heigth, _width div 2 - 140, 3 * _heigth div 5);

        _7resolutiondroit.change_resolution(_width, _heigth, _width div 2 + 110, _heigth div 5);
        _7resolutiongauche.change_resolution(_width, _heigth, _width div 2 - 140, _heigth div 5);

        _7ok.change_resolution(_width, _heigth, _width div 2 - 68, 4 * _heigth div 5 - 50);
        _7annuler.change_resolution(_width, _heigth, _width div 2 - 68, 4 * _heigth div 5 - 15);
        _7apply.change_resolution(_width, _heigth, _width div 2 - 68, 4 * _heigth div 5 + 20);

        _8titou.change_resolution(_width, _heigth, _width div 2 -97, 150);
        _8clad.change_resolution(_width, _heigth, _width div 2 - 97, 150);
        _8mouton.change_resolution(_width, _heigth, _width div 2 - 97, 150);
        _8xoy.change_resolution(_width, _heigth, _width div 2 - 97, 150);

        _8droit.change_resolution(_width, _heigth, _width div 2 + 107, 277);
        _8gauche.change_resolution(_width, _heigth, _width div 2 - 137, 277);
        _8jouer.change_resolution(_width, _width, _width div 2 - 137, 420);

        _retour.change_resolution(_width, _heigth, width - 200, heigth - 80);

        if num_menu <> 1 then
          begin
            _1multi.set_out;
            _1option.set_out;
            _1quitter.set_out;
            _1solo.set_out;
          end;

        if num_menu <> 2 then
          begin
            _2client.set_out;
            _2serveur.set_out;
          end;

        if num_menu <> 3 then
          begin
            _3pseudo.set_out;
            _3pseudotext.set_out;
            _3ip.set_out;
            _3iptext.set_out;
            _3iptext.set_out;
            _3jouer.set_out;
          end;

        if num_menu <> 4 then
          begin
            _4pseudo.set_out;
            _4pseudotext.set_out;
            _4map.set_out;
            _4maptext.set_out;
            _4jouer.set_out;
          end;

        if num_menu <> 5 then
          begin
            _5map.set_out;
            _5maptext.set_out;
            _5charger.set_out;
            _5chargertext.set_out;
            _5jouer.set_out;
          end;

        if num_menu <> 6 then
          begin
            _6quitter.set_out;
            _6oui.set_out;
            _6non.set_out;
          end;

        if num_menu <> 7 then
          begin
            _7resolution.set_out;
            _7resolutiontext.set_out;
            _7resolutiondroit.set_out;
            _7resolutiongauche.set_out;
            _7son.set_out;
            _7sonoui.set_out;
            _7sonnon.set_out;
            _7fog.set_out;
            _7fogtext.set_out;
            _7fogdroit.set_out;
            _7foggauche.set_out;
            _7ok.set_out;
            _7annuler.set_out;
            _7apply.set_out;
          end;

        if num_menu <> 8 then
          begin
            _8titou.set_out;
            _8clad.set_out;
            _8xoy.set_out;
            _8mouton.set_out;
            _8droit.set_out;
            _8gauche.set_out;
            _8jouer.set_out;
          end;
      end;

end.
